#ifndef _HMI_COMMON_DATASTRUCTMACRO_H_
#define _HMI_COMMON_DATASTRUCTMACRO_H_

#include "HmiAdapterRuntime.h"
#include <stdint.h>
#include <stdbool.h>

#define ON 1
#define OFF 0

#define LIGHT_ON_500ms 31
#define LIGHT_OFF_500ms 60

#define SELF_TEST_3S 176
#define SELF_TEST_6S 352
#define AUDIO_90S 5294

typedef struct Option_U8
{
    uint8_t value_;
    bool    update_;
} Option_U8;

typedef struct Option_U16
{
    uint16_t value_;
    bool    update_;
} Option_U16;

typedef struct Option_U32
{
    uint32_t value_;
    bool    update_;
} Option_U32;

typedef struct Option_U64
{
    uint64_t value_;
    bool    update_;
} Option_U64;

typedef struct Option_Float
{
    float value_;
    bool    update_;
} Option_Float;

typedef struct Option_Int
{
    int value_;
    bool    update_;
} Option_Int;

inline uint8_t isOn_500ms(int count) 
{
    int range = count / 30; // 每 30 个数字为一个区间
    return !(range % 2); 
}

inline bool isFinishSelfTest(uint64_t input)
{
    return GetSystemCount() > input;  
}

inline void setOptionValue_U8(Option_U8* show, bool value)
{
    if(show->value_ != value)
    {
        show->value_ = value;
        show->update_ = true;
    }
}

#endif